﻿namespace WP7Contrib.Services.Tests
{
    using System.Globalization;
    using BingMaps.Model;
    using Microsoft.Phone.Controls.Maps;
    using Microsoft.Silverlight.Testing;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    
    [TestClass]
    public class BingMapsSearchCriterionTests : SilverlightTest
    {
        [TestMethod]
        public void ShouldHaveTheSameHashCode()
        {
            // Given we have criterion...
            var criterion = new SearchCriterion
                                {
                                    Query = "coffee shops",
                                    Culture = new CultureInfo("en-GB"),
                                    BoundingRectangle = new LocationRect(0, 90, 0, 90),
                                    Radius = 10,
                                    ResultSize = 50
                                };

            // When we deep clone it...
            var criterionCopy = criterion.DeepClone();

            // Then we expect the hash code to be equal...
            Assert.AreEqual(criterion.GetHashCode(), criterionCopy.GetHashCode());
        }

        [TestMethod]
        public void ShouldHaveEquality()
        {
            // Given we have criterion...
            var criterion = new SearchCriterion
            {
                Query = "coffee shops",
                Culture = new CultureInfo("en-GB"),
                BoundingRectangle = new LocationRect(0, 90, 0, 90),
                Radius = 10,
                ResultSize = 50
            };

            // When we deep clone it...
            var criterionCopy = criterion.DeepClone();

            // Then we expect to be equal...
            Assert.AreEqual(criterion, criterionCopy);
        }
    }
}

